For this method, a so-called oil level regulator is used which monitors the oil level in a machine, for example a compressor, and refills oil from a reservoir as soon as an oil deficiency is determined. However, the optical system used for the monitoring may become soiled over time due to a contaminant layer depositing on the optical system, and the reflection/refraction of the light beam is distorted. This is problematic in particular when the reception signal becomes so weak that it no longer reaches the predefined level value, and always reports a sufficient oil level even though in reality an oil deficiency is already present.